R=range;n,m,*a=map(int,open(0).read().split());print('im'*any([x^1for x in k]!=[*k[::-1]]for k in zip(*sorted([[n